package org.example.user.controller;

import org.example.common.config.Result;
import org.example.user.entity.SysUserRealnameAuthEntity;
import org.example.user.service.ISysUserRealnameAuthService;
import org.example.user.vo.AuthListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/admin")
public class SysAdminController {

    @Autowired
    private ISysUserRealnameAuthService sysUserRealnameAuthService;

    // 管理员获取待审核实名认证列表
    @GetMapping("/user/auth-pending-list")
    public Result getAuthPendingList() {
        List<AuthListVO> authPendingList = sysUserRealnameAuthService.getAuthPendingList();
        return Result.ok(authPendingList);
    }

    //管理员审核实名认证接口
    @PutMapping("/user/auth-verify")
    public Result authVerify(@RequestParam("userId") Long userId,
                             @RequestParam("status") Integer status,
                             @RequestParam("rejectReason") String rejectReason){
        return Result.ok(sysUserRealnameAuthService.authVerify(userId, status, rejectReason));
    }

}
